/**
 * 
 * @param {any} druation    //时间
 * @param {any} from        //起点
 * @param {any} to          //终点
 */
function animation(druation, from, to,onProgress){
    const dis=to-from;
    const speed=dis/druation;
    const startTime=Date.now();
    let value=from;
    // console.log(value);
    function _run(){
        const now =Date.now();
        const time=now-startTime;
        if(time>=druation){
            value=to;
            onProgress(value);
            return;
        }
        const d=time*speed;
        value=from+d;
        onProgress(value);
        requestAnimationFrame(_run);

    }
    requestAnimationFrame(_run);
}